<%-- 
    Document   : AllotRoom
    Created on : Apr 10, 2014, 2:02:08 PM
    Author     : mishra
--%>

<%@page import="Hostel.HostelBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%! int fid = 0;%>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Allot_Room").toString().equals("1")) {
                fid = FeeType.Query.getFeeTypeId("FEE_TYPE_NAME", "Hostel Fee");
%>
<%String to = "", status = "", msg = "";%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Ramgovind Automated System</title>
        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function getRoomNumber(value) {
                var a = "<option value=''>Select Room </option>";
                var xmlhttp;
                if (window.XMLHttpRequest)
                {
                    xmlhttp = new XMLHttpRequest();
                }
                else
                {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function()
                {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                    {
                        document.getElementById('roomid').innerHTML = a + xmlhttp.responseText;
                    }
                }
                xmlhttp.open("POST", "/RIT/GetRoom?roomno=" + value, true);
                xmlhttp.send();
            }
            function getBeds(value) {
                var a = "<option value=''>Select Bed</option>";
                var xmlhttp;
                if (window.XMLHttpRequest)
                {
                    xmlhttp = new XMLHttpRequest();
                }
                else
                {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function()
                {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                    {
                        document.getElementById('bedno').innerHTML = a + xmlhttp.responseText;
                    }
                }
                xmlhttp.open("POST", "/RIT/GetBeds?roomNo=" + value, true);
                xmlhttp.send();
            }
            function getStuDetails() {

                var xmlhttp;
                var val = document.getElementById('admid').value;
                var fval = document.getElementById('ftid').value;
                if (val != "" && fval != "0")
                {
                    if (window.XMLHttpRequest)
                    {
                        xmlhttp = new XMLHttpRequest();
                    }
                    else
                    {
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange = function()
                    {

                        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                        {
                            document.getElementById('stude').innerHTML = xmlhttp.responseText;
                        }
                    }
                    xmlhttp.open("POST", "/RIT/getStuDetail?admiId=" + val + "&ftype=" + fval, true);
                    xmlhttp.send();
                }
                else
                {
                    alert("record Not Found");
                }
            }
            function getAdditionalAmt(roomid) {
                var xmlhttp;
                if (window.XMLHttpRequest)
                {
                    xmlhttp = new XMLHttpRequest();
                }
                else
                {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function()
                {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                    {
                        var resu = parseInt(xmlhttp.responseText);
                        if (resu > 0) {
                            document.getElementById('res').style.visibility = 'visible';
                            document.getElementById('aamt').value = xmlhttp.responseText;
                        } else {
                            document.getElementById('res').style.visibility = 'hidden';
                            document.getElementById('aamt').value = xmlhttp.responseText;
                        }
                    }
                }
                xmlhttp.open("POST", "/RIT/getAdditionalAmt?roomId=" + roomid, true);
                xmlhttp.send();
            }
        </script>
    </head>
    <body>
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Services/Hostel/hostelsidenav.html" %>
                <div class="content">
                    <%if (session.getAttribute("status") != null) {
                            status = session.getAttribute("status").toString();
                            msg = session.getAttribute("msg").toString();
                    %>
                    <div class="alert alert-info alert-block">
                        <a class="close" data-dismiss="alert" href="#"><img src="/RIT/img/mclose.png"></a>
                        <h4 class="alert-heading"> <%=status%></h4>
                        <%=msg%>

                    </div>
                    <%session.removeAttribute("status");
                            session.removeAttribute("msg");
                        }%>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Allotment Details </h3>
                                </div>
                                <form action="/RIT/AllotRoom" method="post" class='validate form-horizontal'>
                                    <div class="box-content">
                                        <!---Form Start....-->
                                        <div id="lside" style="float: left; margin-top: 10px;">
                                            <div class="control-group">
                                                <label for="admid" class="control-label">Admission ID<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" class="required" name="admid" id="admid">
                                                    <input type="hidden" class="required" name="ftid" id="ftid" value="<%=fid%>">
                                                </div>
                                            </div>
                                        </div>
                                        <div id="rside" style="float: left; margin-right: 120px; margin-top: 10px">
                                            <div class="control-group">
                                                <label for="searchid" class="control-label"></label>
                                                <div class="controls">
                                                    <div class="input-append">
                                                        <center>
                                                            <button type="button" class="btn btn-info" id="searchid" style="padding-top: 5px; padding-bottom: 5px; padding-left: 10px; padding-right: 10px;" onclick="getStuDetails()">Search Student Details</button>
                                                        </center>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div id="stude">

                                        </div>

                                        <!---Form Ends....-->
                                    </div>
                                    <div class="form-actions">
                                        <input type="submit" class='btn btn-primary'>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>	
            </div>
        </div>
        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
    </body>
</html>

<%} else {
%>
<script type="text/javascript">
                                                                    alert("You Are Not Authorised");
                                                                    window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>
